package  com.cnn.function.stock.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cnn.base.util.JsonUtil;
import  com.cnn.function.stock.pojo.StockOutDetails;
import  com.cnn.function.stock.service.StockOutDetailsService;

@RestController
@RequestMapping("/stockOutDetails")
public class StockOutDetailsController {

	@Resource
	private StockOutDetailsService stockOutDetailsService;

	@RequestMapping("/getStockOutDetails")
	public String getStockOutDetails() {
		return JsonUtil.success(stockOutDetailsService.getStockOutDetails());
	}

	@RequestMapping("/getStockOutDetailsById")
	public String getStockOutDetailsById(String id) {
		return JsonUtil.success(stockOutDetailsService.getStockOutDetailsById(Long.valueOf(id)));
	}

	@RequestMapping("/addStockOutDetails")
	public String addStockOutDetails(StockOutDetails stockOutDetails) {
		stockOutDetailsService.addStockOutDetails(stockOutDetails);
		return JsonUtil.success();
	}

	@RequestMapping("/updateStockOutDetails")
	public String updateStockOutDetails(StockOutDetails stockOutDetails) {
		stockOutDetailsService.updateStockOutDetails(stockOutDetails);
		return JsonUtil.success();
	}

	@RequestMapping("/deleteStockOutDetails")
	public String deleteStockOutDetails(String id) {
		stockOutDetailsService.deleteStockOutDetails(Long.valueOf(id));
		return JsonUtil.success();
	}
}
